i want to get the number of rows from my class Matrix and rows are dynamically created.
what is the method so than i can get the number of rows.should i use dot operator?
i want to get the number of rows from my class Matrix and rows are dynamically created.
what is the method so than i can get the number of rows.should i use dot operator?
once a kohatian,always a kohatian!
It's better to make all data in a class private and access it with functions...
myclass c;
int data = c.getdata();
class myclass
{
public:
myclass() { data = 5; }
int getdata() { return data; }
private:
int data;
};
Have a data member in your class that gets set to the number of rows whenever the matrix gets allocated. Then simply have your method return the value of that data member. Initialize it to 0 in the constructor(s).
"Owners of dogs will have noticed that, if you provide them with food and water and shelter and affection, they will think you are god. Whereas owners of cats are compelled to realize that, if you provide them with food and water and shelter and affection, they draw the conclusion that they are gods."
-Christopher Hitchens