Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7058899
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T04:10:03+00:00 2026-05-28T04:10:03+00:00

Givetn two class names, className1 and className2 , how can I check if className1

  • 0

Givetn two class names, className1 and className2, how can I check if className1 has className2 anywhere in its heritage?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-28T04:10:04+00:00Added an answer on May 28, 2026 at 4:10 am

    Alas, [incr Tcl] only supports introspection on objects and not on classes; you’ll have to make an instance of className1, fetch its heritage with info heritage $theInstance, and check whether className2 is present in that list. Messy. (From 4.0 onwards you could use info class subclasses className2 className1 to check if className1 is a direct subclass of className2, but that doesn’t work for indirect subclasses, i.e., with some subclasses in between.)

    However, general principles of OO programming in Tcl would tend to indicate that you should use duck typing if you can: don’t worry about whether the object is of the right class, worry about whether it can respond to the messages you want to send to it (i.e., the methods you want to invoke). Since any object can trap attempts to invoke unknown method calls, you can’t really find out what it will actually do by introspection, and have to Just Try It. Or look for some documentation if you’re lucky.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have two questions regarding the '::' case class. :: can be used as
Given two methods on the same class in Java : public void doSomething( Person
This is easier to explain with an example. Given these two classes: public class
Given the following two ways of defining a class method in Ruby: class Foo
Given I have a class with two constructors: public class TestClass { ObjectOne o1;
Given two colors and n steps, how can one calculate n colors including the
Given these two models: class Profile(models.Model): user = models.ForeignKey(User, unique=True, verbose_name=_('user')) about = models.TextField(_('about'),
I have the following two models class Author(Model): name = CharField() class Publication(Model): title
Hi all NHibernate gurus ! Given these two classes : public class User {
Given two tables, Make and Model, where a make can contain many models and

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.